document.write('<script type="text/javascript" src="/upload/beans/beans_announcePages.js"></script>');

//var bdy = (document.documentElement && document.documentElement.clientWidth)?document.documentElement:document.body;
  var bdy = (document.body==null)?document.documentElement:document.body;

 var Sys = {};
        var ua = navigator.userAgent.toLowerCase();
        if (window.ActiveXObject)
            Sys.ie = ua.match(/msie ([\d.]+)/)[1];
        else if (document.getBoxObjectFor)
            Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1];
        else if (window.MessageEvent && !document.getBoxObjectFor)
            Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1];
        else if (window.opera)
            Sys.opera = ua.match(/opera.([\d.]+)/)[1];
        else if (window.openDatabase)
            Sys.safari = ua.match(/version\/([\d.]+)/)[1];

if (Sys.firefox) {  
window.addEventListener('DOMContentLoaded', show, false);   //firefox
} else if (Sys.ie)  {
  window.attachEvent('onload', show);  //IE
}

function show(){

	var currentURL=window.location.href;
	var searchUrlFlag = currentURL.indexOf("?") ; //获取url中"?"符后的字串
	if(searchUrlFlag!=-1){currentURL=currentURL.substring(0,searchUrlFlag);}
	var str=temp.split("|");
    var urlstr=currentURL.split("/");
    var urlmod="";
    var shouyexianshi=0;
    for(var i=3;i<urlstr.length;i++){
     urlmod=urlmod+"/"+urlstr[i];
    }

 	var today = new Date();
        var todayYear="";
        if(Sys.ie){todayYear = Number(today.getYear());}
        if(Sys.firefox){todayYear = Number(today.getFullYear());}
	var todayMonth = Number(today.getMonth() + 1);
	var todayDay = Number(today.getDate());
	var todayHour=Number(today.getHours());
	var todayMinute=Number(today.getMinutes());

  for(i=0;i<str.length;i=i+9)
  {      
	  	//if(currentURL.indexOf(str[i+1])>0)
        if(urlstr.length==4 && urlmod=='/' && (str[i+1]=="/index.shtml" || str[i+1]=="/index.jsp" ) ){shouyexianshi=1;}
        if((urlmod==str[i+1]) || (shouyexianshi==1))
	  	{		
				var year, month, day;
		    var startDateStr =str[i+3];
            var startArray = startDateStr.split("-");
		  	var closeDateStr = str[i+4];
		  	var closeArray = closeDateStr.split("-");
			

            var startTimeStr=str[i+7];
            var stArray=startTimeStr.split(":");
			var closeTimeStr=str[i+8];
			var ctArray=closeTimeStr.split(":");
			

		  	if(closeArray.length < 3)
		  	{
		  		continue;
		  	}
            if(startArray.length < 3)
		  	{
		  		continue;
		  	}
            if(stArray.length < 2)
		  	{
		  		continue;
		  	}
			if(ctArray.length < 2)
		  	{
		  		continue;
		  	}
			  startYear=Number(startArray[0]);
		  	startMonth = Number(startArray[1]);
		  	startDay = Number(startArray[2]);
		  	year = Number(closeArray[0]);
		  	month = Number(closeArray[1]);
		  	day = Number(closeArray[2]);
          
            startHour=Number(stArray[0]);
			startMinute=Number(stArray[1]);
			closeHour=Number(ctArray[0]);
			closeMinute=Number(ctArray[1]);
			
			
			if( (year > todayYear) || 
				(year == todayYear && month > todayMonth) || 
				(year == todayYear && month == todayMonth && day > todayDay) ||
				(year == todayYear && month == todayMonth && day == todayDay && closeHour > todayHour ) ||
				(year == todayYear && month == todayMonth && day == todayDay && closeHour > todayHour && closeMinute >=todayMinute) 
			  )
			{
			 if((startYear < todayYear) || 
				(startYear == todayYear && startMonth < todayMonth) || 
				(startYear == todayYear && startMonth == todayMonth && startDay < todayDay)  ||
                                (startYear == todayYear && startMonth == todayMonth && startDay == todayDay && startHour<todayHour) ||
				(startYear == todayYear && startMonth == todayMonth && startDay == todayDay && startHour==todayHour && startMinute <= todayMinute )

				)
				{
                                 if(shouyexianshi==1){shouyexianshi=0;}
				 showAnnounce(str[i+2],str[i],str[i+5],str[i+6]);
				}
			}
  }
  }
  
}

function showAnnounce(src,type,width,height){
  if(type=='pop'){
	showWindow(src,width,height);
  }else if(type=='scroll'){
	createSlideDIV(src,width,height);
	  myScroll();
  }else{
	showWindow(src,width,height);
  }

}

function showWindow(srcPage,widthPage,heightPage){
	//window.showModelessDialog(srcPage,'Notice Board','center:yes;dialogLeft:5px;dialogTop:10px;scroll:1;status:0;help:0;resizable:0;dialogWidth:widthPage;dialogHeight:heightPage');
	     if (Sys.ie == '6.0') // IE6的打开窗口高度包括了标题栏和状态栏
         {
            heightPage =parseFloat(heightPage)+60;
            widthPage=parseFloat(widthPage)+ 20;
         } else if (Sys.ie == '7.0') // IE7环境下的打开窗口高度则不包括状态栏和标题栏 ,IE8环境下的打开窗口高度不包括状态栏和标题栏(但是有内边距10px左右)
         {
           heightPage =parseFloat(heightPage)- 10;
           widthPage=parseFloat(widthPage)- 10;
         }
		
		if(Sys.firefox)
	 {
		var initParam='';
		initParam="top=0,left=0,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no,width="+widthPage;
		initParam =initParam+",height="+heightPage;	
		window.open(srcPage,"newwindow",initParam);  
	 }
	 else{
		 var initParam='';
		initParam="center:yes;dialogLeft:5px;dialogTop:10px;scroll:1;status:0;help:0;resizable:0;dialogWidth:"+widthPage+"px";
		initParam =initParam+";dialogHeight:"+heightPage+"px";	
		window.showModelessDialog(srcPage,'Notice Board',initParam);
	 }
}

function createSlideDIV(srcPage,widthPage,heightPage){	
	var slideDiv=document.createElement("div");	
	slideDiv.setAttribute("id","floatWindow");
	slideDiv.style.position="absolute";	
	slideDiv.style.zIndex="1000";	
	slideDiv.style.width=widthPage;
	slideDiv.style.height=heightPage;
	slideDiv.style.overflow="hidden";
    slideDiv.style.display="block";
    slideDiv.style.float="left";
	//slideDiv.style.top=(bdy.scrollTop+bdy.offsetHeight-257)+"px";
	slideDiv.style.top=(bdy.scrollTop+bdy.offsetHeight-205)+"px";
	slideDiv.style.right="3px";
	slideDiv.style.border="1px solid #CBCBCB";
	var iframeObj=document.createElement("iframe");	
	iframeObj.setAttribute("src",srcPage);
	iframeObj.setAttribute('frameborder', '0', 0);
	//iframeObj.style.width="260px";
	//iframeObj.style.height="228px";
	iframeObj.style.width=widthPage;
	iframeObj.style.height=heightPage;
	iframeObj.style.scrolling="auto";
	
	var title=document.createElement("h4");
   	title.setAttribute("id","msgTitle");
  	title.setAttribute("align","right");
   	title.style.margin="0";
   	title.style.padding="3px";
   	title.style.background="#EEEEEE";
   	title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,finishOpacity=100);";
   	title.style.opacity="0.75";
   	title.style.borderTop="1px solid #EEEEEE";
   	title.style.borderLeft="1px solid #EEEEEE";
   	title.style.borderRight="1px solid #EEEEEE";
   	title.style.borderBottom="1px solid #CBCBCB";
   	title.style.height="12px";
   	title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
   	title.style.color="#666666";
   	title.style.cursor="pointer";
   	title.innerHTML="Close";


   	title.onclick=function(){
        document.getElementById("floatWindow").style.display="none";
	}
	slideDiv.appendChild(title);
	slideDiv.appendChild(iframeObj);
	if(document.body!=null){document.body.appendChild(slideDiv);}
	}

function myScroll(){
	
	//document.getElementById("floatWindow").style.top=(bdy.scrollTop+bdy.offsetHeight-257)+'px';
	document.getElementById("floatWindow").style.top=(bdy.scrollTop+bdy.offsetHeight-205)+'px';
	document.getElementById("floatWindow").style.right=3+'px';
	setTimeout("myScroll();",50);
}